<!DOCTYPE html>
<html>
<head>
    <title>综能魔方Cube+高校综合素质评价系统</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.7.2/font/bootstrap-icons.min.css" rel="stylesheet">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css">
    <style>
        .navbar-nav .nav-link {
            padding: 0.5rem 1rem;
        }
        .navbar-nav .nav-link i {
            margin-right: 0.5rem;
        }
        .dropdown-menu {
            padding: 0.5rem 0;
            display: none;
        }
        .dropdown-item {
            padding: 0.5rem 1rem;
        }
        .dropdown-item i {
            margin-right: 0.5rem;
        }
        .badge {
            margin-left: 0.5rem;
        }
        .dropdown:hover .dropdown-menu {
            display: block;
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">
                <i class="bi bi-mortarboard"></i> 综能魔方|Cube+高校综合素质评价系统
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarContent">
                <ul class="navbar-nav me-auto">
                    {% if current_user.is_authenticated %}
                        <li class="nav-item">
                            <a class="nav-link" href="/dashboard">
                                <i class="bi bi-house-door"></i> 首页
                            </a>
                        </li>

                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                                <i class="bi bi-clipboard-data"></i> 综测管理
                            </a>
                            <ul class="dropdown-menu">
                                <li><a class="dropdown-item" href="/academic"><i class="bi bi-book"></i> 学业成绩</a></li>
                                <li><a class="dropdown-item" href="/moral"><i class="bi bi-heart"></i> 德育素质</a></li>
                                <li><a class="dropdown-item" href="/physical"><i class="bi bi-dribbble"></i> 体育素质</a></li>
                                <li><a class="dropdown-item" href="/ability"><i class="bi bi-lightbulb"></i> 能力素质</a></li>
                                <li><a class="dropdown-item" href="/labor"><i class="bi bi-tools"></i> 劳育素质</a></li>
                                <li><hr class="dropdown-divider"></li>
                                <li><a class="dropdown-item" href="/"><i class="bi bi-calculator"></i> 综合评定</a></li>
                            </ul>
                        </li>
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                                <i class="bi bi-trophy"></i> 推优管理
                            </a>
                            <ul class="dropdown-menu">
                                <li><a class="dropdown-item" href="/scholarship"><i class="bi bi-cash"></i> 奖助学金申请</a></li>
                                <li><a class="dropdown-item" href="/outstanding"><i class="bi bi-star"></i> 优秀学生推优</a></li>
                            </ul>
                        </li>
                        {% if current_user.role == 'teacher' %}
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                                <i class="bi bi-check2-square"></i> 审核管理
                                {% if pending_count > 0 %}
                                <span class="badge bg-danger">{{ pending_count }}</span>
                                {% endif %}
                            </a>
                            <ul class="dropdown-menu">
                                <li><a class="dropdown-item" href="/academic"><i class="bi bi-book"></i> 学业成绩审核</a></li>
                                <li><a class="dropdown-item" href="/moral"><i class="bi bi-heart"></i> 德育素质审核</a></li>
                                <li><a class="dropdown-item" href="/physical"><i class="bi bi-person-walking"></i> 体育素质审核</a></li>
                                <li><a class="dropdown-item" href="/ability"><i class="bi bi-lightbulb"></i> 能力素质审核</a></li>
                                <li><a class="dropdown-item" href="/labor"><i class="bi bi-tools"></i> 劳育素质审核</a></li>
                                <li><hr class="dropdown-divider"></li>
                                <li><a class="dropdown-item" href="/scholarship"><i class="bi bi-cash"></i> 奖助学金审核</a></li>
                                <li><a class="dropdown-item" href="/outstanding"><i class="bi bi-star"></i> 优秀学生审核</a></li>
                            </ul>
                        </li>
                        {% endif %}
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                                <i class="bi bi-gear"></i> 系统管理
                            </a>
                            <ul class="dropdown-menu">
                                <li><a class="dropdown-item" href="/permission"><i class="bi bi-shield-lock"></i> 权限管理</a></li>
                                <li><a class="dropdown-item" href="/users"><i class="bi bi-people"></i> 用户管理</a></li>
                                <li><a class="dropdown-item" href="/profile"><i class="bi bi-person"></i> 个人中心</a></li>
                                <li><a class="dropdown-item" href="/maintenance"><i class="bi bi-wrench"></i> 系统维护</a></li>
                                <li><a class="dropdown-item" href="/rules"><i class="bi bi-list-check"></i> 测评规则标准管理</a></li>
                            </ul>
                        </li>
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                                <i class="bi bi-exclamation-triangle"></i> 违纪违规管理
                            </a>
                            <ul class="dropdown-menu">
                                <li><a class="dropdown-item" href="/personal_violation"><i class="bi bi-person-x"></i> 个人违规违纪记录</a></li>
                                <li><a class="dropdown-item" href="/all_violations"><i class="bi bi-list-ul"></i> 全院违规违纪记录</a></li>
                            </ul>
                        </li>
                    {% endif %}
                </ul>
                <ul class="navbar-nav">
                    {% if current_user.is_authenticated %}
                        <li class="nav-item">
                            <span class="nav-link">
                                <i class="bi bi-person-circle"></i>
                                {% if current_user.role == 'student' %}
                                    {{ current_user.real_name }} | {{ current_user.class_name }}
                                {% elif current_user.role == 'teacher' %}
                                    {{ current_user.real_name }}老师 | {{ current_user.class_name }}
                                {% else %}
                                    {{ current_user.real_name }}
                                {% endif %}
                            </span>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/logout">
                                <i class="bi bi-box-arrow-right"></i> 退出
                            </a>
                        </li>
                    {% else %}
                        <li class="nav-item">
                            <a class="nav-link" href="/login">
                                <i class="bi bi-box-arrow-in-right"></i> 登录
                            </a>
                        </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ category if category != 'message' else 'info' }} alert-dismissible fade show" role="alert">
                        {{ message }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        
        {% block content %}{% endblock %}
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
    <script>
    document.addEventListener('DOMContentLoaded', function() {
        var dropdowns = document.querySelectorAll('.dropdown-toggle');
        dropdowns.forEach(function(dropdown) {
            new bootstrap.Dropdown(dropdown);
        });

        $('.dropdown').hover(
            function() {
                $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(200);
            },
            function() {
                $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(200);
            }
        );
    });
    </script>
</body>
</html> 